#ifndef _ESAM_H_
#define _ESAM_H_

#include "driverh.h"

BOOL EsamInit(void);
INT32 EsamGetNewRandom(INT8U bLen, INT8U *pbBuf, INT16U wTimeout);
INT32 EsamTxRx(INT8U *pbTxBuf, INT16U wTxLen, INT8U *pbRxBuf, INT16U wRxLen, INT16U wTimeout);

void MasterAntiChange(INT8U *buff, INT8U *data, INT16U size);
void MasterXorTwoBuff(INT8U *p1, const INT8U *p2, INT16U size);
INT32 EsamCheckMacAll(INT8U bAFN, INT8U bA3, INT16U wGrpAddr, INT8U *pbData, INT16U wDataLen, INT8U *pbMacData, INT16U wTimeout);
INT32 EsamGetSeris(INT8U *pbBuf, INT16U wTimeout);
INT32 EsamGetTermInfo(INT8U P1, INT8U *pbTx, INT32U dwTimeout);
INT32 EsamDialogOpt(INT8U *pbRx, INT8U *pbTx, INT32U dwTimeout);
INT32 EsamDialogArrange(INT8U *pbRx, INT8U *pbTx, INT32U dwTimeout);
INT32 EsamCheckMac(INT8U bAFN, INT8U *pbData, INT16U wDataLen, INT8U *pbMacData, INT16U wTimeout);
INT32 EsamUdpSymKey(INT8U *pbRx, INT8U *pbTx, INT32U dwTimeout);
INT32 EsamUdpTermCft(INT8U P1, INT8U *pbTx, INT32U dwTimeout);
INT32 EsamUdpCACft(INT8U *pbRx, INT8U *pbTx, INT32U dwTimeout);
INT32 EsamInAuth(INT8U *pbRx, INT8U *pbTx, INT32U dwTimeout);
INT32 EsamExtAuth(INT8U *pbRx, INT8U *pbTx, INT32U dwTimeout);
INT32 EsamStateSw(INT8U *pbRx, INT8U *pbTx, INT32U dwTimeout);
INT32 EsamSetOfflineCntr(INT8U *pbRx, INT8U *pbTx, INT32U dwTimeout);
INT32 EsamTstEptAct(INT8U *pbRx, INT8U *pbTx, INT32U dwTimeout);
INT32 EsamMtrAuth(INT8U P2, INT8U *pbMtrAddr, INT8U *pbMtrKey, INT8U *pbTaskDat, INT8U *pbRandom, INT8U *pbTx, INT32U dwTimeout);
INT32 EsamRdShareFile(INT8U *pbRx, INT32U dwTimeout);
INT32 EsamWrShareFile(INT8U *pbTx, INT8U bLen, INT32U dwTimeout);
INT32 EsamMtrTaskOpt
    (INT8U *pbTaskFmt, INT8U bTaskType, INT8U *pbTaskDat, INT16U bTaskDatLen,
    INT8U *pMtrKey, INT8U *pbMtrRandom, INT8U *pbMtrTime, INT8U *pbReBuf, INT32U dwTimeout);


#endif
